package com.minhang.utils.result;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 统一API响应结果封装
 * @author dkj
 */
public class Result<T> {
    /**
     * //错误信息编码
     */
    private int code;
    /**
     *  //消息
     */
    private String message;
    /**
     * //数据
     */
    private T data;
    /**
     * //总数
     */
    private int count;

    /**
     * 路径
     */
    @JsonIgnore
    private String filePath;

    public String getFilePath() {
        return filePath;
    }

    public Result<T> setFilePath(String filePath) {
        this.filePath = filePath;
        return this;
    }

    public Result<T> setCode(ResultCode resultCode) {
        this.code = resultCode.code();
        return this;
    }
    public Result<T> setCode(int code){
        this.code = code;
        return this;
    }

    public int getCode() {
        return code;
    }

    public int getCount() {
        return count;
    }

    public String getMessage() {
        return message;
    }

    public Result<T> setMessage(String message) {
        this.message = message;
        return this;
    }

    public Result<T> setCount(int count) {
        this.count = count;
        return this;
    }

    public T getData() {
        return data;
    }

    public Result<T> setData(T data) {
        this.data = data;
        return this;
    }


}
